import sys
import Ui_scanport
import Func_scanport
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
from Func_ComboBoxControl import MyComboBoxControl



if __name__ == '__main__':
    app = QApplication(sys.argv)
    MainWindow = QMainWindow()
    ui = Ui_scanport.Ui_MainWindow()
    func = Func_scanport.Serial_func()
    ui.setupUi(MainWindow)
    # 这里通过重写combox的方法实现了click的自动刷新
    ui.portComboBox = MyComboBoxControl(ui.horizontalLayoutWidget)
    ui.portComboBox.setObjectName("portComboBox")
    ui.horizontalLayout.addWidget(ui.portComboBox)

    ui.openPort.clicked.connect(func.ScanPort)
    MainWindow.show()
    sys.exit(app.exec_())
